package com.bh.ly.oa.util;

import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;

import android.os.Handler;
import android.os.Message;

public class ListThread extends Thread {
	
	public static final int REFRESH = 0;
	public static final int LOAD = 1;
	
	private String urlType ;
	private Handler mHandler;
	private Map<String, Object> map;
	
	private ListThread(){
	}
	
	public ListThread(Handler handler,  Map<String, Object> arg, String urlType){
		this.mHandler = handler;
		this.map = arg;
		this.urlType = urlType;
	}
	
	@Override
	public void run() {
		JSONObject licenseJsonData = null;
		if(urlType.equals(Config.orderDetail))
			licenseJsonData = HttpClent.getOrderDetaillistJsonData(map);
		if(urlType.equals(Config.listSupplierCertificate))
			licenseJsonData = HttpClent.getLicenseJsonData(map);
		
		if(urlType.equals(Config.listAnnouncement))
			licenseJsonData = HttpClent.getNoticeJsonData(map);
		
		if(urlType.equals(Config.listSupplierSaleDaily))
			licenseJsonData = HttpClent.getSuppliersaleJsonData(map);
		
		if(urlType.equals(Config.listGoodsSaleDept))
			licenseJsonData = HttpClent.getGoodsaleJsonData(map);
		
		if(urlType.equals(Config.listBilReturnfac))
			licenseJsonData = HttpClent.getRelbackOrderJsonData(map);
		
		if(urlType.equals(Config.newOderlist))
			licenseJsonData = HttpClent.getOrderJsonData(map);
		
		Message msg = new Message();
		msg.obj = licenseJsonData;
		mHandler.sendMessage(msg);
	}
}
